<?php
/**
 * Application level Controller
 *
 * This file is application-wide controller file. You can put all
 * application-wide controller-related methods here.
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Controller
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

App::uses('Controller', 'Controller');

/**
 * Application Controller
 *
 * Add your application-wide methods in the class below, your controllers
 * will inherit them.
 *
 * @package		app.Controller
 * @link		http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
 */
class AppController extends Controller {
    public function beforeFilter()
    {
        parent::beforeFilter();

        if($_SERVER['SERVER_ADDR'] == '211.151.100.202')
        {
            $this->server_url = 'http://211.151.100.202:33001';
            $this->header_name = "런런 테스트 용";
            $this->db_name = array(
                'game_data' => 'zeus_game_data_run',
                'user_data' => 'zeus_user_data_run',
                'log' => 'zeus_log_data_run'
            );
        }
        else
        {
            if( $this->passedArgs[0] == 0 )
            {
                $this->server_url = 'http://192.168.0.201:33001';
                $this->header_name = "내부 테스트 용";
                $this->db_name = array(
                    'game_data' => 'zeus_game_data_test',
                    'user_data' => 'zeus_user_data_test',
                    'log' => 'zeus_log_data_test'
                );
            }
            else if( $this->passedArgs[0] == 1 )
            {
                $this->server_url = 'http://192.168.0.52:33001';
                $this->header_name = "내부 마이 테스트 용";
                $this->db_name = array(
                    'game_data' => 'zeus_game_data_test_my',
                    'user_data' => 'zeus_user_data_test_my',
                    'log' => 'zeus_log_data_test_my'
                );
            }
            else if( $this->passedArgs[0] == 2 )
            {
                $this->server_url = 'http://210.65.163.97:33001';
                $this->header_name = "킹넷 테스트 서버";
                $this->db_name = array(
                    'game_data' => 'zeus_game_data_king_test',
                    'user_data' => 'zeus_user_data_king_test',
                    'log' => 'zeus_log_data_king_test'
                );
            }
            else if( $this->passedArgs[0] == 3 )
            {
                $this->server_url = 'http://210.65.163.98:33001';
                $this->header_name = "킹넷 서버";
                $this->db_name = array(
                    'game_data' => 'zeus_game_data_king',
                    'user_data' => 'zeus_user_data_king',
                    'log' => 'zeus_log_data_king'
                );
            }
        }

        $this->set(compact(array('testTest')));
    }

    public function beforeRender()
    {
        parent::beforeRender();
    }

    public function afterFilter()
    {
        parent::afterFilter();
    }

    // /patch/game_data/cbt/client_game_data.json
    // /patch/game_data/cbt/client_game_data.json
}
